
/*
DROP TABLE ANSI;
DROP TABLE "Areas";
DROP TABLE "BannedIPAddresses";
DROP TABLE "DoorSides";
DROP TABLE "Doors";
DROP TABLE "Exits";
DROP TABLE "HelpTopicAliases";
DROP TABLE "HelpTopics";
DROP TABLE IAC;
DROP TABLE MXP;
DROP TABLE "MobTypes";
DROP TABLE "Mobs";
DROP TABLE "MudChannelRoles";
DROP TABLE "MudChannels";
DROP TABLE "PlayerChannels";
DROP TABLE "PlayerIPAddress";
DROP TABLE "PlayerRoles";
DROP TABLE "Players";
DROP TABLE "PortalExits";
DROP TABLE "Roles";
DROP TABLE "RoomTypes";
DROP TABLE "RoomVisuals";
DROP TABLE "Rooms";
DROP TABLE "Typos";

DROP GENERATOR ANSI_GENERATOR;
DROP GENERATOR AREAS_GENERATOR;
DROP GENERATOR BANNEDIPADDRESSES_GENERATOR;
DROP GENERATOR DOORSIDES_GENERATOR;
DROP GENERATOR DOORS_GENERATOR;
DROP GENERATOR EXITS_GENERATOR;
DROP GENERATOR HELPTOPICALIASES_GENERATOR;
DROP GENERATOR HELPTOPICS_GENERATOR;
DROP GENERATOR IAC_GENERATOR;
DROP GENERATOR MOBS_GENERATOR;
DROP GENERATOR MOBTYPES_GENERATOR;
DROP GENERATOR MUDCHANNELROLES_GENERATOR;
DROP GENERATOR MUDCHANNELS_GENERATOR;
DROP GENERATOR MXP_GENERATOR;
DROP GENERATOR PLAYERCHANNELS_GENERATOR;
DROP GENERATOR PLAYERIPADDRESS_GENERATOR;
DROP GENERATOR PLAYERROLES_GENERATOR;
DROP GENERATOR PLAYERS_GENERATOR;
DROP GENERATOR PORTALEXITS_GENERATOR;
DROP GENERATOR ROLES_GENERATOR;
DROP GENERATOR ROOMS_GENERATOR;
DROP GENERATOR ROOMTYPES_GENERATOR;
DROP GENERATOR ROOMVISUALS_GENERATOR;
DROP GENERATOR TYPOS_GENERATOR;

DROP DOMAIN D_BOOLEAN;
*/

CREATE DOMAIN D_BOOLEAN AS
  SMALLINT
  DEFAULT 0
  CHECK (VALUE BETWEEN 0 AND 1);

CREATE TABLE ANSI (
	ID INTEGER NOT NULL,
	"EscapeCode" VARCHAR(50) CHARACTER SET UNICODE_FSS NOT NULL,
	"Tag" VARCHAR(25) CHARACTER SET UNICODE_FSS NOT NULL,
PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_ANSI
  ON ANSI
  (ID);

CREATE SEQUENCE ANSI_GENERATOR;
ALTER SEQUENCE ANSI_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER ANSI_TRIGGER FOR "ANSI"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(ANSI_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "Areas" (
  ID      INTEGER NOT NULL,
  UID     VARCHAR(50) CHARACTER SET UNICODE_FSS,
  "Name"  VARCHAR(45) CHARACTER SET UNICODE_FSS,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_AREAS
  ON "Areas"
  (ID);

CREATE SEQUENCE AREAS_GENERATOR;
ALTER SEQUENCE AREAS_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER AREAS_TRIGGER FOR "Areas"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(AREAS_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "BannedIPAddresses" (
	ID INTEGER NOT NULL,
	"StartIPAddress" VARCHAR(20) CHARACTER SET UNICODE_FSS NOT NULL,
	"EndIPAddress" VARCHAR(20) CHARACTER SET UNICODE_FSS NOT NULL,
	"Note" VARCHAR(255) CHARACTER SET UNICODE_FSS NOT NULL,
	"BannedByPlayerID" INTEGER NOT NULL,
	"BannedDateTime" DATE NOT NULL,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_BANNEDIPADDRESSES
  ON "BannedIPAddresses"
  (ID);

CREATE SEQUENCE BANNEDIPADDRESSES_GENERATOR;
ALTER SEQUENCE BANNEDIPADDRESSES_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER BANNEDIPADDRESSES_TRIGGER FOR "BannedIPAddresses"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(BANNEDIPADDRESSES_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "Doors" (
	ID INTEGER NOT NULL,
	"DoorSideAID" INTEGER,
	"DoorSideBID" INTEGER,
	"OpenState" INTEGER,
	"Name" VARCHAR(45) CHARACTER SET UNICODE_FSS,
	"Description" VARCHAR(1000) CHARACTER SET UNICODE_FSS,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_DOORS
  ON "Doors"
  (ID);

CREATE SEQUENCE DOORS_GENERATOR;
ALTER SEQUENCE DOORS_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER DOORS_TRIGGER FOR "Doors"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(DOORS_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "DoorSides" (
	ID INTEGER NOT NULL,
	"Name" VARCHAR(45) CHARACTER SET UNICODE_FSS,
	"Description" VARCHAR(1000) CHARACTER SET UNICODE_FSS,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_DOORSIDES
  ON "DoorSides"
  (ID);

CREATE SEQUENCE DOORSIDES_GENERATOR;
ALTER SEQUENCE DOORSIDES_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER DOORSIDES_TRIGGER FOR "DoorSides"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(DOORSIDES_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "Exits" (
	ID INTEGER NOT NULL,
	"ExitRoomAID" INTEGER,
	"DirectionA" VARCHAR(50) CHARACTER SET UNICODE_FSS,
	"ExitRoomBID" INTEGER,
	"DirectionB" VARCHAR(50) CHARACTER SET UNICODE_FSS,
	"DoorID" INTEGER,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_EXITS
  ON "Exits"
  (ID);

CREATE SEQUENCE EXITS_GENERATOR;
ALTER SEQUENCE EXITS_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER EXITS_TRIGGER FOR "Exits"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(EXITS_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "HelpTopicAliases" (
	ID INTEGER NOT NULL,
	"HelpTopicAlias" VARCHAR(50) CHARACTER SET UNICODE_FSS NOT NULL,
	"HelpTopicID" INTEGER,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_HELPTOPICALIASES
  ON "HelpTopicAliases"
  (ID);

CREATE SEQUENCE HELPTOPICALIASES_GENERATOR;
ALTER SEQUENCE HELPTOPICALIASES_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER HELPTOPICALIASES_TRIGGER FOR "HelpTopicAliases"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(HELPTOPICALIASES_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "HelpTopics" (
	ID INTEGER NOT NULL,
	"HelpTopic" VARCHAR(50) CHARACTER SET UNICODE_FSS NOT NULL,
	"Usage" VARCHAR(255) CHARACTER SET UNICODE_FSS,
	"Description" VARCHAR(1000) CHARACTER SET UNICODE_FSS,
	"Example" VARCHAR(1000) CHARACTER SET UNICODE_FSS,
	"SeeAlso" VARCHAR(1000) CHARACTER SET UNICODE_FSS,
	"ViewTemplate" VARCHAR(255) CHARACTER SET UNICODE_FSS,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_HELPTOPICS
  ON "HelpTopics"
  (ID);

CREATE SEQUENCE HELPTOPICS_GENERATOR;
ALTER SEQUENCE HELPTOPICS_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER HELPTOPICS_TRIGGER FOR "HelpTopics"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(HELPTOPICS_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE IAC (
	ID INTEGER NOT NULL,
	"Name" VARCHAR(50) CHARACTER SET UNICODE_FSS,
	"OptionCode" INTEGER,
	"NegotiateAtConnect" D_BOOLEAN NOT NULL,
	"RequiresSubNegotiation" D_BOOLEAN NOT NULL,
	"SubNegAssembly" VARCHAR(50) CHARACTER SET UNICODE_FSS,
	"NegotiationStartValue" VARCHAR(50) CHARACTER SET UNICODE_FSS,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_IAC
  ON IAC
  (ID);

CREATE SEQUENCE IAC_GENERATOR;
ALTER SEQUENCE IAC_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER IAC_TRIGGER FOR IAC
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(IAC_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "Mobs" (
	ID INTEGER NOT NULL,
	"MobTypeID" INTEGER,
	"Name" VARCHAR(45) CHARACTER SET UNICODE_FSS,
	"Title" VARCHAR(50) CHARACTER SET UNICODE_FSS,
	"Description" VARCHAR(250) CHARACTER SET UNICODE_FSS,
	"Age" INTEGER,
	"CurrentRoomID" INTEGER,
	"Prompt" VARCHAR(50) CHARACTER SET UNICODE_FSS,
	"CreateDate" DATE NOT NULL,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_MOBS
  ON "Mobs"
  (ID);

CREATE SEQUENCE MOBS_GENERATOR;
ALTER SEQUENCE MOBS_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER MOBS_TRIGGER FOR "Mobs"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(MOBS_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "MobTypes" (
	ID INTEGER NOT NULL,
	"MobTypeName" VARCHAR(50) CHARACTER SET UNICODE_FSS NOT NULL,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_MOBTYPES
  ON "MobTypes"
  (ID);

CREATE SEQUENCE MOBTYPES_GENERATOR;
ALTER SEQUENCE MOBTYPES_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER MOBTYPES_TRIGGER FOR "MobTypes"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(MOBTYPES_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "MudChannelRoles" (
	ID INTEGER NOT NULL,
	"MudChannelID" INTEGER NOT NULL,
	"RoleID" INTEGER NOT NULL,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_MUDCHANNELROLES
  ON "MudChannelRoles"
  (ID);

CREATE SEQUENCE MUDCHANNELROLES_GENERATOR;
ALTER SEQUENCE MUDCHANNELROLES_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER MUDCHANNELROLES_TRIGGER FOR "MudChannelRoles"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(MUDCHANNELROLES_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "MudChannels" (
	ID INTEGER NOT NULL,
	"MudChannelName" VARCHAR(50) CHARACTER SET UNICODE_FSS NOT NULL,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_MUDCHANNELS
  ON "MudChannels"
  (ID);

CREATE SEQUENCE MUDCHANNELS_GENERATOR;
ALTER SEQUENCE MUDCHANNELS_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER MUDCHANNELS_TRIGGER FOR "MudChannels"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(MUDCHANNELS_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE MXP (
	ID INTEGER NOT NULL,
	"ElementName" VARCHAR(50) CHARACTER SET UNICODE_FSS,
	"ElementDefinition" VARCHAR(50) CHARACTER SET UNICODE_FSS NOT NULL,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_MXP
  ON MXP
  (ID);

CREATE SEQUENCE MXP_GENERATOR;
ALTER SEQUENCE MXP_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER MXP_TRIGGER FOR MXP
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(MXP_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "PlayerChannels" (
	ID INTEGER NOT NULL,
	"PlayerID" INTEGER NOT NULL,
	"ChannelID" INTEGER NOT NULL,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_PLAYERCHANNELS
  ON "PlayerChannels"
  (ID);

CREATE SEQUENCE PLAYERCHANNELS_GENERATOR;
ALTER SEQUENCE PLAYERCHANNELS_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER PLAYERCHANNELS_TRIGGER FOR "PlayerChannels"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(PLAYERCHANNELS_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "PlayerIPAddress" (
	ID INTEGER NOT NULL,
	"PlayerID" INTEGER NOT NULL,
	"IPAddress" VARCHAR(50) CHARACTER SET UNICODE_FSS NOT NULL,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_PLAYERIPADDRESS
  ON "PlayerIPAddress"
  (ID);

CREATE SEQUENCE PLAYERIPADDRESS_GENERATOR;
ALTER SEQUENCE PLAYERIPADDRESS_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER PLAYERIPADDRESS_TRIGGER FOR "PlayerIPAddress"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(PLAYERIPADDRESS_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "PlayerRoles" (
	ID INTEGER NOT NULL,
	"PlayerID" INTEGER NOT NULL,
	"RoleID" INTEGER NOT NULL,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_PLAYERROLES
  ON "PlayerRoles"
  (ID);

CREATE SEQUENCE PLAYERROLES_GENERATOR;
ALTER SEQUENCE PLAYERROLES_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER PLAYERROLES_TRIGGER FOR "PlayerRoles"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(PLAYERROLES_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "Players" (
	ID INTEGER NOT NULL,
	"UserName" VARCHAR(45) CHARACTER SET UNICODE_FSS NOT NULL,
	"Password" VARCHAR(45) CHARACTER SET UNICODE_FSS NOT NULL,
	"DisplayName" VARCHAR(50) CHARACTER SET UNICODE_FSS,
	"Suffix" VARCHAR(45) CHARACTER SET UNICODE_FSS,
	"Prefix" VARCHAR(45) CHARACTER SET UNICODE_FSS,
	"Title" VARCHAR(50) CHARACTER SET UNICODE_FSS,
	"Description" VARCHAR(250) CHARACTER SET UNICODE_FSS,
	"Age" INTEGER,
	"CreateDate" VARCHAR(50) CHARACTER SET UNICODE_FSS,
	"CurrentRoomID" INTEGER,
	"Prompt" VARCHAR(50) CHARACTER SET UNICODE_FSS,
	"WantAnsi" D_BOOLEAN,
	"WantMXP" D_BOOLEAN,
	"WantMCCP" D_BOOLEAN,
	"LastLogin" VARCHAR(50) CHARACTER SET UNICODE_FSS,
	"LastLogout" VARCHAR(50) CHARACTER SET UNICODE_FSS,
	"LastIPAddress" VARCHAR(50) CHARACTER SET UNICODE_FSS,
	"Email" VARCHAR(100) CHARACTER SET UNICODE_FSS,
	"HomePage" VARCHAR(4000) CHARACTER SET UNICODE_FSS,
	"PlanText" VARCHAR(4000) CHARACTER SET UNICODE_FSS,
	"BufferLength" INTEGER NOT NULL,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_PLAYERS
  ON "Players"
  (ID);

CREATE SEQUENCE PLAYERS_GENERATOR;
ALTER SEQUENCE PLAYERS_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER PLAYERS_TRIGGER FOR "Players"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(PLAYERS_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "PortalExits" (
	ID INTEGER NOT NULL,
	"PortalID" INTEGER NOT NULL,
	"RoomAID" INTEGER,
	"RoomBID" INTEGER,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_PORTALEXITS
  ON "PortalExits"
  (ID);

CREATE SEQUENCE PORTALEXITS_GENERATOR;
ALTER SEQUENCE PORTALEXITS_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER PORTALEXITS_TRIGGER FOR "PortalExits"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(PORTALEXITS_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "Roles" (
	ID INTEGER NOT NULL,
	"Name" VARCHAR(50) CHARACTER SET UNICODE_FSS NOT NULL,
	"SecurityRoleMask" INTEGER NOT NULL,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_ROLES
  ON "Roles"
  (ID);

CREATE SEQUENCE ROLES_GENERATOR;
ALTER SEQUENCE ROLES_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER ROLES_TRIGGER FOR "Roles"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(ROLES_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "Rooms" (
	ID INTEGER NOT NULL,
	"UID" VARCHAR(50) CHARACTER SET UNICODE_FSS,
	"AreaID" INTEGER,
	"Name" VARCHAR(45) CHARACTER SET UNICODE_FSS NOT NULL,
	"Description" VARCHAR(1000) CHARACTER SET UNICODE_FSS,
	"RoomTypeID" INTEGER,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_ROOMS
  ON "Rooms"
  (ID);

CREATE SEQUENCE ROOMS_GENERATOR;
ALTER SEQUENCE ROOMS_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER ROOMS_TRIGGER FOR "Rooms"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(ROOMS_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "RoomTypes" (
	ID INTEGER NOT NULL,
	"Name" VARCHAR(50) CHARACTER SET UNICODE_FSS NOT NULL,
	"Description" VARCHAR(1000) CHARACTER SET UNICODE_FSS,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_ROOMTYPES
  ON "RoomTypes"
  (ID);

CREATE SEQUENCE ROOMTYPES_GENERATOR;
ALTER SEQUENCE ROOMTYPES_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER ROOMTYPES_TRIGGER FOR "RoomTypes"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(ROOMTYPES_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "RoomVisuals" (
	ID INTEGER NOT NULL,
	"RoomID" INTEGER NOT NULL,
	"Name" VARCHAR(59) CHARACTER SET UNICODE_FSS NOT NULL,
	"Description" VARCHAR(255) CHARACTER SET UNICODE_FSS NOT NULL,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_ROOMVISUALS
  ON "RoomVisuals"
  (ID);

CREATE SEQUENCE ROOMVISUALS_GENERATOR;
ALTER SEQUENCE ROOMVISUALS_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER ROOMVISUALS_TRIGGER FOR "RoomVisuals"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(ROOMVISUALS_GENERATOR, 1);
END^

SET TERM ; ^

CREATE TABLE "Typos" (
	ID INTEGER NOT NULL,
	"Note" VARCHAR(500) CHARACTER SET UNICODE_FSS NOT NULL,
	"SubmittedByPlayerID" INTEGER NOT NULL,
	"RoomID" INTEGER NOT NULL,
	"SubmittedDateTime" VARCHAR(30) CHARACTER SET UNICODE_FSS NOT NULL,
	"Resolved" D_BOOLEAN NOT NULL,
	"ResolvedByPlayerID" INTEGER,
	"ResolvedDateTime" VARCHAR(30) CHARACTER SET UNICODE_FSS,
  PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PK_TYPOS
  ON "Typos"
  (ID);

CREATE SEQUENCE TYPOS_GENERATOR;
ALTER SEQUENCE TYPOS_GENERATOR RESTART WITH 0;

SET TERM ^;

CREATE TRIGGER TYPOS_TRIGGER FOR "Typos"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  if (NEW.ID is NULL) then NEW.ID = GEN_ID(TYPOS_GENERATOR, 1);
END^

SET TERM ; ^